/*
 * Copyright (c) 2010-2011 NutShell.
 * [Project:YAM,Id:Operate.java  2011-10-03 17:52:07 poplar.mumu ]
 */
package org.mumu.pawn.domain;

import org.hibernate.validator.constraints.Length;
import org.mumu.pawn.fm.annotation.OrderByColumn;
import org.richfaces.component.SortOrder;

import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * 模块资源 实体
 * <br/>
 *
 * @author poplar.mumu
 * @version 1.0 2011-10-03 17:52:07
 * @since JDK 1.0
 */
@Entity
@Table(name = "OPERATE")
public class Operate implements Serializable {

    private static final long serialVersionUID = 6358013821598128467L;
    /**
     * 主键
     */
    private long id;

    /**
     * 对应模块地址
     */
    private Module module;
    /**
     * 操作名称
     */
    private String operateName;
    /**
     * 操作标识
     */
    private String operateSign;
    /**
     * 操作请求
     */
    private String operateAction;
    /**
     * 创建时间
     */
    @OrderByColumn(order = SortOrder.ascending)
    private long createTime;
    /**
     * 创建人
     */
    private long createActor;
    /**
     * 修改时间
     */
    private long updateTime;
    /**
     * 修改人
     */
    private long updateActor;
    /**
     * 排序
     */
    private int sort;

    /**
     * @return 主键
     */
    @Id
    @GeneratedValue
    public long getId() {
        return id;
    }

    /**
     * 设置 主键[ID]
     *
     * @param id 主键
     */
    public void setId(long id) {
        this.id = id;
    }

    /**
     * @return 模块
     */
    @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
    @JoinColumn(name = "MODULE")
    public Module getModule() {
        return module;
    }

    /**
     * 设置 模块[MODULE]
     *
     * @param module 模块
     */
    public void setModule(Module module) {
        this.module = module;
    }

    /**
     * @return 操作名称
     */
    @Column(name = "OPERATE_NAME")
    @Length(max = 30, min = 1)
    @NotNull
    public String getOperateName() {
        return operateName;
    }

    /**
     * 设置 操作名称[OPERATE_NAME]
     *
     * @param operateName 操作名称
     */
    public void setOperateName(String operateName) {
        this.operateName = operateName;
    }

    /**
     * @return 操作标识
     */
    @Column(name = "OPERATE_SIGN")
    @Length(max = 15, min = 10)
    @NotNull
    public String getOperateSign() {
        return operateSign;
    }

    /**
     * 设置 操作标识[OPERATE_SIGN]
     *
     * @param operateSign 操作标识
     */
    public void setOperateSign(String operateSign) {
        this.operateSign = operateSign;
    }

    /**
     * @return 操作请求
     */
    @Column(name = "OPERATE_ACTION")
    @Length(max = 100)
    public String getOperateAction() {
        return operateAction;
    }

    /**
     * 设置 操作请求[OPERATE_ACTION]
     *
     * @param operateAction 操作请求
     */
    public void setOperateAction(String operateAction) {
        this.operateAction = operateAction;
    }

    /**
     * @return 创建时间
     */
    @Column(name = "CREATE_TIME")
    public long getCreateTime() {
        return createTime;
    }

    /**
     * 设置 创建时间[CREATE_TIME]
     *
     * @param createTime 创建时间
     */
    public void setCreateTime(long createTime) {
        this.createTime = createTime;
    }

    /**
     * @return 创建人
     */
    @Column(name = "CREATE_ACTOR")
    public long getCreateActor() {
        return createActor;
    }

    /**
     * 设置 创建人[CREATE_ACTOR]
     *
     * @param createActor 创建人
     */
    public void setCreateActor(long createActor) {
        this.createActor = createActor;
    }

    /**
     * @return 修改时间
     */
    @Column(name = "UPDATE_TIME")
    public long getUpdateTime() {
        return updateTime;
    }

    /**
     * 设置 修改时间[UPDATE_TIME]
     *
     * @param updateTime 修改时间
     */
    public void setUpdateTime(long updateTime) {
        this.updateTime = updateTime;
    }

    /**
     * @return 修改人
     */
    @Column(name = "UPDATE_ACTOR")
    public long getUpdateActor() {
        return updateActor;
    }

    /**
     * 设置 修改人[UPDATE_ACTOR]
     *
     * @param updateActor 修改人
     */
    public void setUpdateActor(long updateActor) {
        this.updateActor = updateActor;
    }

    /**
     * @return 排序
     */
    @Column(name = "SORT")
    public int getSort() {
        return sort;
    }

    /**
     * 设置 排序[SORT]
     *
     * @param sort 排序
     */
    public void setSort(int sort) {
        this.sort = sort;
    }
}